<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ include file="/WEB-INF/jsp/base/global.jsp"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>登录页面</title>
		<script type="text/javascript" src="${path}/static/js/jquery-1.10.2.min.js"></script>
		<script type="text/javascript">
			function login(){
			    $("#loginButton").attr('disabled',true);  
			     $.ajax({
	             //几个参数需要注意一下
	                type: "POST",   //方法类型
	                dataType: "json",  //预期服务器返回的数据类型
	                url: "${path}/user/login" ,//url
	                data: $('#loginform').serialize(),
	                success: function (result) {
	                     if(result.code==200){
	                    	 alert(result.msg);
	                    	 window.location.href="${path}"+result.url;	 
	                     }else{
	                    	 alert(result.msg);
	                    	 $("#loginButton").attr('disabled',false); 
	                     }      
	                },
	                error : function() {
	                    alert("异常！");
	                }
	             });
			}
		</script>
	</head>
	<body>
		<form id="loginform" >
			用户名: <input type="text" name="username" /><br>
		   	密 码 :<input type="password" name="password" /><br>
			 
			<button id="loginButton" onclick="login();">登录</button>
		</form>
		
	</body>
	
</html>
